<?php !defined('BASE_ROOT') && exit ( 'Access Denied!' );
class  Model extends Basic{

	private $_parent_name;

	final public function __construct() {
		$this->_assign_libraries();
		$this->_parent_name = ucfirst(get_class($this));
	}
	/**
	 * 调用全局的变量
	 */
	private function _assign_libraries()
	{
		$CAI =& get_instance();
		foreach (array_keys(get_object_vars($CAI)) as $key)
		{
			if ( ! isset($this->$key) && $key != $this->_parent_name)
			{
				$this->$key = NULL; // Needed to prevent reference errors with some configurations
				$this->$key =& $CAI->$key;
			}
		}
	}

	/**
	 * 缓存构造函数
	 */
	public function cache($limit_time = null)
	{
		return $this->plugin('Cache')->init($this, $limit_time);
	}
}